package com.zxh.cloudDemo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by zxhhd on 2017/12/31.
 *
 * 直接用程序名（service-hi）替代了具体的url地址，在ribbon中它会根据服务名来选择具体的服务实例，
 * 根据服务实例在请求的时候会用具体的url替换掉服务名
 */
@Service
public class HelloService {

	@Autowired
	RestTemplate restTemplate;

	public String hiService(String name){
	 	return restTemplate.getForObject("http://this-is-service/hi?name="+name,String.class);
	}
}
